import bpy
for i in range(10):
    for j in range(10):
        for k in range(10):
            cube = bpy.ops.mesh.primitive_cube_add(size=1,location=(i,j,k),rotation= (0,0,0),scale=(1,1,1))